﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace calendar
{
    public abstract class ProjectCalendarDateRange : IEnumerable<DateRange>
    {

        private List<DateRange> m_ranges = new List<DateRange>();

        public void addRange(DateRange range)
        {
            m_ranges.Add(range);
        }

        public DateRange getRange(int index)
        {
            DateRange result;
            if (index >= 0 && index < m_ranges.Count)
            {
                result = m_ranges[index];
            }
            else
            {
                result = DateRange.EMPTY_RANGE;
            }
            return result;
        }

        public void setRange(int index, DateRange value)
        {
            m_ranges[index] = value;
        }

        public int getRangeCount()
        {
            return m_ranges.Count;
        }

        IEnumerator<DateRange> IEnumerable<DateRange>.GetEnumerator()
        {
            return m_ranges.GetEnumerator();
        }


        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }
    }
}
